package com.java83.service.impl;

import com.java83.dao.EmployeeDao;
import com.java83.entity.Employee;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName: EntryManagementService
 * @Description: EntryManagementService业务逻辑层实现类
 * @Author: TangShuJi
 * @Date: 2021/12/14 15:19
 * @Version: V1.0
 **/
@Service(value = "entryManagementService")
public class EntryManagementService implements com.java83.service.EntryManagementService {

    //@Autowired(required = false)
    @Resource
    private EmployeeDao employeeDao;

    /**
     * @Author: TangShuJi
     * @Description: (业务逻辑层)添加员工方法
     * @Date: 2021/12/14 16:45
     * @Param: [employee] 需要被添加的员工
     * @Return: int
     **/
    @Override
    public int add(Employee employee) {
        int num = employeeDao.add(employee);
        return num;
    }

    /**
     * @Author: TangShuJi
     * @Description: (业务逻辑层)通过id删除员工方法
     * @Date: 2021/12/14 17:31
     * @Param: [id] 需要被删除的员工
     * @Return: int
     **/
    @Override
    public int deleteEmployee(int id) {
        int num = employeeDao.deleteById(id);
        return num;
    }

    /**
     * @Author: TangShuJi
     * @Description: (业务逻辑层)修改员工方法
     * @Date: 2021/12/14 17:42
     * @Param: [employee] 需要被修改的员工
     * @Return: int
     **/
    @Override
    public int updateEmployee(Employee employee) {
        int mun = employeeDao.update(employee);
        return mun;
    }

    /**
     * @Author: TangShuJi
     * @Description: (业务逻辑层)查询所有员工方法
     * @Date: 2021/12/14 20:22
     * @Param: [employee] 需要被查询的员工信息
     * @Return: java.util.List<com.java83.entity.Employee>
     **/
    @Override
    public List<Employee> findAllEmployee(Employee employee) {
        List<Employee> employeeList = employeeDao.findAll(employee);
        return employeeList;
    }


}
